﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Sunimage.Spjg.BLL.SysMgr;
using Sunimage.Spjg.Common;
using Sunimage.Spjg.Common.SysMgr;
using Sunimage.Spjg.Web.Helper;

namespace Sunimage.Spjg.Web
{
    public partial class Regist : System.Web.UI.Page
    {
        UserBl gsjUserBl = new UserBl();

        protected void btnSaveNewUser_Click(object sender, EventArgs e)
        {
            User user = new User();
            user.Username = tbxUsernameAdd.Text.Trim();
            user.Password = tbxPasswordAdd.Text;
            user.Email = tbxEmail.Text.Trim();
            user.NickName = tbxNickname.Text.Trim();
            user.Role = RoleType.User;

            try
            {
                gsjUserBl.CreateUser(user);
                PnlNewCommercer.Visible = false;
                pnlSuccess.Visible = true;
            }
            catch (ApplicationException excp)
            {
                lblMsg.Text = excp.Message;
                //AlertHelper.ShowError("发生错误，请联系系统管理员", this.Page);
            }
        }
    }
}